/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: jse2204 - Student
 * <p>Powered by webrx On 2022-09-16 14:42:06
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Student {
    private int id;
    private String name;
    private String gender;

    public Student() {
    }

    public Student(int id, String name, String gender) {
        this.id = id;
        this.name = name;
        this.gender = gender;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) throws SexException {
        if("男".equals(gender) || "女".equals(gender)){

        }else{
            throw new SexException("老师的性别必须设置为男或女，性别设置错误");
        }
        this.gender = gender;


    }

    @Override
    protected void finalize() throws Throwable {
        System.out.println("student实例垃圾回收了....");
    }
}
